﻿<UserControl x:Class="FU.Capstones.IMS.Web.Silverlight.Views.ProductList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:Controls="clr-namespace:FU.Capstones.IMS.Web.Silverlight.Controls" 
    xmlns:Navigation="clr-namespace:Navigation.Silverlight;assembly=Navigation.Silverlight"
    xmlns:Common="clr-namespace:FU.Capstones.IMS.Web.Common;assembly=FU.Capstones.IMS.Web.Common"
    xmlns:TControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data" 
	xmlns:NControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    Navigation:ViewModel.TypeName="FU.Capstones.IMS.Web.Silverlight.ViewModels.ProductListViewModel">

    <UserControl.Resources>
        <Common:DataContextProxy x:Key="DataContextProxy" />
    </UserControl.Resources>

    <telerik:RadBusyIndicator 
        BusyContent="Vui lòng đợi khi dữ liệu đang được xử lý!" 
        IsBusy="{Binding Path=ServiceCallCounter, Converter={StaticResource IntegerToBoolConverter}}"        
        >
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!--Title-->
            <Grid Grid.ColumnSpan="3">
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop0}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop1}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop2}"/>
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop3}"/>
                    </LinearGradientBrush>
                </Grid.Background>

                <TextBlock 
                    x:Name="lblTitle" 
                    Style="{StaticResource TextBlockTitlePageStyle}"                   
                    Text="Danh sách thành phẩm"/>
            </Grid>
			
			<NControls:RadTabControl                
                Grid.Row="2"  Grid.Column="0" Grid.ColumnSpan="3"
                Background="Transparent"
                >
				<NControls:RadTabItem
                    Header="Thông tin sản phẩm trong kho"
                    Background="Transparent"
					IsSelected="True"
                    >
					
					<Grid x:Name="Layout" Background="White"
						Grid.Row="1" 
						>
			            <Grid.RowDefinitions>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto" />
			                <RowDefinition Height="10"/>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			            </Grid.RowDefinitions>
			            <Grid.ColumnDefinitions>
			                <ColumnDefinition Width="20"/>
			                <ColumnDefinition Width="*"/>
			                <ColumnDefinition Width="20"/>
			            </Grid.ColumnDefinitions>

			            <!--Search Bar-->
			            <Controls:ProductSearchControl Grid.Column="1" Grid.Row="2" Background="Transparent" Margin="5,0"/>

			            <!--GridView-->
			            <telerikGrid:RadGridView
			                x:Name="GridView"
			                Grid.Row="4" Grid.Column="1"
			                telerik:StyleManager.Theme="Office_Black"
			                Style="{StaticResource RadGridViewNormal}"
			                ItemsSource="{Binding Path=ProductCollection, Mode=TwoWay}"
			                >

			                <telerikGrid:RadGridView.Columns>
			                    
			                    <telerikGrid:GridViewColumn
			                        Header="{StaticResource ProductCodeLabelText}"
			                        Width="80" HeaderTextAlignment="Center">
			                        <telerikGrid:GridViewColumn.CellTemplate>
			                            <DataTemplate>
			                                <HyperlinkButton 
			                                    Content="{Binding Path=ProductCode}"  
			                                    Command="{Binding Path=DataSource.EditCommand, Source={StaticResource DataContextProxy}}"
			                                    CommandParameter="{Binding Path=ProductID}"
			                                />
			                            </DataTemplate>
			                        </telerikGrid:GridViewColumn.CellTemplate>
			                    </telerikGrid:GridViewColumn>

			                    <telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource ProductNameLabelText}"
			                        Width="140" HeaderTextAlignment="Center"
			                        DataMemberBinding="{Binding Path=ProductName}"
			                    />
								
								<telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource WarehouseNameLabelText}"
			                        Width="90" HeaderTextAlignment="Center"
			                        DataMemberBinding="{Binding Path=Warehouse.WarehouseName}"
			                    />
																		
								 <telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource TotalQuantityLabelText}"
			                        Width="90" HeaderTextAlignment="Center"
			                        DataMemberBinding="{Binding Path=Quantity}"
			                    />

			                    <telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource BriefDescriptionLabelText}"
			                        Width="200" HeaderTextAlignment="Center"
			                        DataMemberBinding="{Binding Path=Description}"
			                    />

			                    <!--<telerikGrid:GridViewColumn Width="70" HeaderTextAlignment="Center">
			                        <telerikGrid:GridViewColumn.CellTemplate>
			                            <DataTemplate>
			                                <Grid>
			                                    <HyperlinkButton 
			                                        Content="{StaticResource DeleteButtonText}"    
			                                        Command="{Binding Path=DataSource.DeleteCommand, Source={StaticResource DataContextProxy}}"
			                                        CommandParameter="{Binding Path=ProductID}"
			                                        IsEnabled="{Binding Path=DataSource.CanEditOrAdd, Source={StaticResource DataContextProxy}}"
			                                        Visibility="{Binding Path=IsDelete, Converter={StaticResource InverseBoolToVisibilityConverter}}"
			                                    />
			                                    <TextBlock 
											        Text="{StaticResource DeletedLabelText}"
			                                        Style="{StaticResource TextBlockNormalStyle}"                                        
			                                        Visibility="{Binding Path=IsDelete, Converter={StaticResource BoolToVisibilityConverter}}"
			                                    />
			                                </Grid>
			                            </DataTemplate>
			                        </telerikGrid:GridViewColumn.CellTemplate>
			                    </telerikGrid:GridViewColumn>-->
			                </telerikGrid:RadGridView.Columns>
			            </telerikGrid:RadGridView>
						
						<TControls:RadDataPager
								Grid.Row="5"
								Grid.Column="1"
			                    x:Name="DataPager2"
			                    Source="{Binding Path=ProductCollection, Mode=TwoWay}"
			                    Style="{StaticResource DataPagerNormalStyle}"
			                    />
								
					</Grid>
			
				</NControls:RadTabItem>
				<NControls:RadTabItem
	                    Header="Các loại sản phẩm"
	                    Background="Transparent"
						
	                    >
					<Grid Background="Transparent"
						>
			            <Grid.RowDefinitions>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto" />
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			                <RowDefinition Height="Auto"/>
			            </Grid.RowDefinitions>
			            <Grid.ColumnDefinitions>
			                <ColumnDefinition Width="20"/>
			                <ColumnDefinition Width="*"/>
			                <ColumnDefinition Width="20"/>
			            </Grid.ColumnDefinitions>
						
						<!--GridView-->
			            <telerikGrid:RadGridView
			                x:Name="grdMaterial2" 
			                Grid.Row="4" Grid.Column="1" 
			                telerik:StyleManager.Theme="Office_Black"
			                Style="{StaticResource RadGridViewNormal}"
			                ItemsSource="{Binding Path=ProductTypeCollection, Mode=TwoWay}" 
			                >

			                <telerikGrid:RadGridView.Columns>

			                    <telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource ProductCodeLabelText}"
			                        Width="80" HeaderTextAlignment="Center">
			                        <telerikGrid:GridViewDataColumn.CellTemplate>
			                            <DataTemplate>
			                                <HyperlinkButton 
			                                    Content="{Binding Path=ProductCode}"  
			                                    Command="{Binding Path=DataSource.EditCommand, Source={StaticResource DataContextProxy}}"
			                                    CommandParameter="{Binding Path=ProductID}"
			                                />
			                            </DataTemplate>
			                        </telerikGrid:GridViewDataColumn.CellTemplate>
			                    </telerikGrid:GridViewDataColumn>

			                    <telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource ProductNameLabelText}"
			                        Width="140" HeaderTextAlignment="Center"
			                        DataMemberBinding="{Binding Path=ProductName}"
			                    />
								
			                    <telerikGrid:GridViewDataColumn 
			                        Header="{StaticResource BriefDescriptionLabelText}"
			                        Width="200" HeaderTextAlignment="Center"
			                        DataMemberBinding="{Binding Path=Description}"
			                    />

			                    <telerikGrid:GridViewColumn Width="70" HeaderTextAlignment="Center">
			                        <telerikGrid:GridViewColumn.CellTemplate>
			                            <DataTemplate>
			                                <Grid>
			                                    <HyperlinkButton 
			                                        Content="{StaticResource DeleteButtonText}"    
			                                        Command="{Binding Path=DataSource.DeleteCommand, Source={StaticResource DataContextProxy}}"
			                                        CommandParameter="{Binding Path=ProductID}"
			                                        IsEnabled="{Binding Path=DataSource.CanEditOrAdd, Source={StaticResource DataContextProxy}}"
			                                        Visibility="{Binding Path=IsDelete, Converter={StaticResource InverseBoolToVisibilityConverter}}"
			                                    />
			                                    <TextBlock 
											        Text="{StaticResource DeletedLabelText}"
			                                        Style="{StaticResource TextBlockNormalStyle}"                                        
			                                        Visibility="{Binding Path=IsDelete, Converter={StaticResource BoolToVisibilityConverter}}"
			                                    />
			                                </Grid>
			                            </DataTemplate>
			                        </telerikGrid:GridViewColumn.CellTemplate>
			                    </telerikGrid:GridViewColumn>
			                </telerikGrid:RadGridView.Columns>
			            </telerikGrid:RadGridView>
						
						<!--Button-->
			            <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"
								Grid.Row="5" Grid.Column="1"
								>
			                <Controls:AddButtonControl                         
		                        Visibility ="{Binding Path=CanAdd, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
		                        />
								
							<Controls:ShowAllCheckBoxControl  
								Visibility ="{Binding CanEditOrAdd, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}"                  
		                        />
						</StackPanel>
						
						<TControls:RadDataPager
								Grid.Row="5"
								Grid.Column="1"
			                    x:Name="DataPager"
			                    Source="{Binding Path=ProductTypeCollection, Mode=TwoWay}"
			                    Style="{StaticResource DataPagerNormalStyle}"
			                    />
						
					</Grid>
		               
					
				</NControls:RadTabItem>
			</NControls:RadTabControl>

            
			                
        </Grid>
    </telerik:RadBusyIndicator>
</UserControl>
